package org.vectrics.domain;

import org.vectrics.common.db.RecordObject;
import org.vectrics.common.util.FileUtil;
import org.vectrics.provider.CoreServiceLocator;

public class HtmlFormType {
	private HtmlFormType parent = null;
	private String code = null;
	private String name = null;
	
	public HtmlFormType() {
		super();
	}

	
	/**
	 * @return Returns the parent.
	 */
	public HtmlFormType getParent() {
		return parent;
	}

	/**
	 * @param parent The parent to set.
	 */
	public void setParent(HtmlFormType parent) {
		this.parent = parent;
	}


	/**
	 * @return Returns the code.
	 */
	public String getCode() {
		return code;
	}


	/**
	 * @param code The code to set.
	 */
	public void setCode(String code) {
		this.code = code;
	}



	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	public String getCssFileName(Domain domain) {
		String fileName = CoreServiceLocator.getConfiguration().getHtmlStyleDirectory();
		if (fileName.endsWith("/") == false) {
			fileName += "/";
		}
		fileName += "default" + "/"
		    + this.code;
	//	FileUtil.createDirectoryIfNotExist(fileName);
		
		fileName += "/main.css";
		return(fileName);
	}
	
	
	public String toString() {
		return("code=" + this.code + "|name=" + this.name);
	}
	
}
